package com.colbby.datahouse.transform;

import com.colbby.datahouse.utils.CastUtils;
import com.colbby.datahouse.utils.TypeDescriptor;
import com.colbby.datahouse.utils.TypeUtils;

public class CharTransformer implements DataTypeTransform<Character> {

	public static final CharTransformer INSTANCE = new CharTransformer();
	
	@Override
	public Character transform(TypeDescriptor returnType, Object value) {
		return CastUtils.castToChar(CastUtils.getValue(value));
	}

	@Override
	public boolean shouldDo(TypeDescriptor returnType, Object value) {
		return TypeUtils.isSuperClass(Character.class, returnType.getTypeClass());
	}

}
